<div id="iframe-container"><iframe name="dymcIframe" style="margin-top:20px; border:0; width:100%; height:850px;"></iframe></div>
<script >
function loadJquery(win, onload){
    if (! win.jQuery) {
	    var doc = win.document;
		var je = doc.createElement("script"); 
		je.setAttribute("type", "text/javascript"); 
		je.setAttribute("src", "//cdn.bootcss.com/jquery/2.1.4/jquery.min.js");
		var heads = doc.getElementsByTagName("head"); 
		if (heads.length) {
			heads[0].appendChild(je);
		} else {
			doc.documentElement.appendChild(je);
		}
    }
	var iv = setInterval(function(){
        win.jQuery && ! function(){
            clearInterval(iv);
            if ('function' == typeof onload) {
                win.jQuery(function(){
                    onload(win.jQuery);
                });
            }
        }();
    }, 10);
}

loadJquery(window, function($){
    function xhrIframe(win, url, data, onload, extra){
        //其它参数：请求方式GET|POST、。。。
        extra = extra || {
            reqMethod:'GET'
        };
        //loading..
        $(win.document.body).append('<img src="/static/img/loading.gif" style="position:fixed; top:50%; left:50%; margin-left:-32px; margin-top:-32px;"></div>');
        $.ajax({
            data : data || {},
            dataType : "html",
            url : url,
            type : extra.reqMethod,
            beforeSend : function(xhr){
                xhr.setRequestHeader("USE-IFRAME", "1");
            },
            success : function(html){
                var doc = win.document.open("text/html", "replace");
        		doc.write(html);
        		doc.close();
        		onload(win);
            }
        });
    };
    
    function onloadIframe(win){
        loadJquery(win, function($){
            $('a').each(function(i, e){
	            /*
	             * 控制没有设置target的a标签的默认点击行为，加上Header头标识，避免新开的窗口重复加载父窗口的代码。
	             * (如果不方便使用该方式，需要保留URL，也可以自行设置target=_parent。)
	             */
	            var checkTarget = -1 != ['_self', '', undefined].indexOf(e.target);
	            var checkHref = -1 == ['javascript:;', 'javascript:void();', 'javascript:void(0);', 'javascript:void()', 'javascript:void(0)'].indexOf(e.href);
    	        if (checkTarget && checkHref) {
	    	        $(e).click(function(evt){
	    	            xhrIframe(win, this.href, {}, onloadIframe);
	    	            return false;
	    	        });
    	        }
            });
        });
    };
    
    
    /**
     * [开放给子窗口内调用的API]以GET方式加载到dymcIframe页中
	 * 方便其内容加载时带上Header头标识
	 * 不支持跨域
     */
    window.loadIframe = function(window, url, data){
        xhrIframe(window, url, data, onloadIframe);
    };
    
    
    /**
     * [开放给子窗口内调用的API]以POST方式加载到dymcIframe页中
	 * 方便其内容加载时带上Header头标识
	 * 不支持跨域
     */
    window.loadIframeByPost = function(window, url, data){
        xhrIframe(window, url, data, onloadIframe, {reqMethod:'POST'});
    };
    
    
    //开始加载iframe内容
    var url = "<{url r=$route}>";
    var data = <{json_encode($request) nofilter}>;
    loadIframe(window.dymcIframe, url, data);
});


</script>


<!-- <div id="iframe-container"><iframe name="dymcIframe" style="margin-top:20px; border:0; width:100%; height:850px;"></iframe></div>
<script >
window.jQuery || document.write("\<script src=\"//cdn.bootcss.com/jquery/2.1.4/jquery.min.js\"\>\<\/script\>");
$(function(){
    $.ajax({
        data : <{json_encode($request) nofilter}>,
        dataType : "html",
        url : "<{url r=$route}>",
        type : "GET",
        beforeSend : function(xhr){
            xhr.setRequestHeader("USE-IFRAME", "1");
        },
        success : function(html){
            var doc = window.dymcIframe.document.open("text/html", "replace");
    		doc.write(html);
    		doc.close();
        }
    });
});
</script> -->